﻿using System;
using System.Collections.Generic;
using System.Web;
using Models;
using System.Linq;


namespace WxPayAPI
{
    /**
    * 	配置账号信息
    */
    public class WxPayConfig
    {
        private static Entities db = new Entities();
       


        public static WeChatConfig mywc = db.WeChatConfig.FirstOrDefault();
        public static string APPID =Convert.ToString(mywc.APPID);
        public static string APPSECRET = Convert.ToString(mywc.APPSECRET);
        public static string MCHID = mywc.MCHID == null ? "" : mywc.MCHID.ToString();
        public static string KEY = mywc.KEY == null ? "" : mywc.PayAPI.ToString();//商户中心API密钥
        public static string PAYURL = mywc.PayUrl == null ? "" : mywc.PayUrl.ToString();
        public static string loginURL = mywc.ReUrl == null ? "" : mywc.ReUrl.ToString();
        public static string NOTIFY_URL = mywc.NotifyUrl == null ? "" : mywc.NotifyUrl.ToString();

        public static string FILEPATH = HttpContext.Current.Server.MapPath(@"~/App_Data/XMLFile.xml");
        //public static WeChatConfig getKey()
        //{
        //    return db.WeChatConfig.FirstOrDefault();
        //}


        //=======【支付结果通知url】===================================== 
        /* 支付结果通知回调url，用于商户接收支付结果
        */



        //=======【证书路径设置】===================================== 
        /* 证书路径,注意应该填写绝对路径（仅退款、撤销订单时需要）
        */
        public const string SSLCERT_PATH = "cert/apiclient_cert.p12";
        public const string SSLCERT_PASSWORD = "1233410002";






        //=======【商户系统后台机器IP】===================================== 
        /* 此参数可手动配置也可在程序中自动获取
        */
        public const string IP = "8.8.8.8";


        //=======【代理服务器设置】===================================
        /* 默认IP和端口号分别为0.0.0.0和0，此时不开启代理（如有需要才设置）
        */
        public const string PROXY_URL = "http://10.152.18.220:8080";

        //=======【上报信息配置】===================================
        /* 测速上报等级，0.关闭上报; 1.仅错误时上报; 2.全量上报
        */
        public const int REPORT_LEVENL = 2;

        //=======【日志级别】===================================
        /* 日志等级，0.不输出日志；1.只输出错误信息; 2.输出错误和正常信息; 3.输出错误信息、正常信息和调试信息
        */
        public const int LOG_LEVENL = 3;
    }
}